package cn.com.aiouyi.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.com.aiouyi.entity.NavigationPosition;
import cn.com.aiouyi.page.Filter;
import cn.com.aiouyi.service.MemberService;
import cn.com.aiouyi.service.NavigationPositionService;
import cn.com.aiouyi.util.AssertUtils;

/**
 * Service - 导航位
 * @author hanson
 *
 */
@Service("navigationPositionServiceImpl")
public class NavigationPositionServiceImpl extends BaseServiceImpl<NavigationPosition, Long> implements NavigationPositionService{

	@Resource(name = "memberServiceImpl")
	private MemberService memberService;
	
	@Override
	public NavigationPosition save(NavigationPosition entity) {
		/*Member m = new Member();
		m.setUsername("admintt");
		m.setPassword(DigestUtils.md5Hex("123456"));
		memberService.save(m);*/
		
		return super.save(entity);
	}
	
	@Override
	public NavigationPosition findByCode(NavigationPosition.Code code) {
		AssertUtils.notNull(code);
		
		List<Filter> filters = new ArrayList<Filter>();
		filters.add(Filter.eq("code", code));
		return this.findOne(filters);
	}
}
